import * as constents from './createTypes'
import { fromJS } from 'immutable'

const defaultValue = fromJS({
    articleList: [],
    recommendList: [],
    //加载更多实现分页功能
    pageList: 1
})

export default (state = defaultValue, action) => {
    switch (action.type) {
        case constents.CHANGE_HOME_DATA:
            // console.log(action)
            return state.merge({
                articleList: fromJS(action.articleList),
                recommendList: fromJS(action.recommendList)
            })
        case constents.GET_MORE_INFO:
        return state.set('articleList', state.get('articleList').concat(action.data)).set('pageList', action.nextPage)
            // pageList: action.nextPage
        default:
            return state
    }

}